import request from '@/router/axios';
export const selectAll = () => {
  return request({
    url: '/api/beetles-business/customer/selectAll',
    method: 'get',
    params: {
    }
  })
}
export const getList = (current, size, params) => {
  return request({
    url: '/api/beetles-business/customer/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/beetles-business/customer/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/beetles-business/customer/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/beetles-business/customer/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/beetles-business/customer/submit',
    method: 'post',
    data: row
  })
}

export const stateUpdate = (id) =>{
  return request({
    url:'/api/beetles-business/customer/status-change',
    method:'put',
    params:{
      customerId :id
    }
  })
}

export const getShareCustomer = () =>{
  return request({
    url:'/api/beetles-business/customer/get-share-customer',
    method:'get',
  })
}

//获取销售经理列表
export const getSalesManager = () =>{
  return request({
    url:'/api/blade-user/select-user?roleAlias=sales_manager',
    method:'get',
  })
}
//获取客户经理列表
export const getCustomerManager = () =>{
  return request({
    url:'/api/blade-user/select-user?roleAlias=customer_manager',
    method:'get',
  })
}
//获取创建人列表
export const getCreateUser = () =>{
  return request({
    url:'/api/blade-user/select/user?statusList=0,1,2&isAll=true',
    method:'get',
  })
}
export const syncLevel = (data) =>{
  return request({
    url: '/api/beetles-business/customer/sync_level',
    method: 'post',
    data: data
  })
}

export const alterStatus = (data) =>{
  return request({
    url: '/api/beetles-business/customer/alter_status',
    method: "post",
    data: data
  })
}

//客户管理评论
export const getComment = (customerId,commentPage,isPin) => {
  return request({
    url: '/api/beetles-business/customerComment/page',
    method: 'get',
    params: {
      customerId,
      ...commentPage,
      isPin

    }
  })
}
//发布评论
export const sendComment = data => {
  return request({
    url: '/api/beetles-business/customerComment/create',
    method: 'post',
    data
  })
}
//改变pin
export const changeCommentPin = data => {
  return request({
    url: '/api/beetles-business/customerComment/changePin',
    method: 'post',
    data
  })
}
//评论权限
export const getCommentPermission = (customerId) => {
  return request({
    url: '/api/beetles-business/customerComment/getCommentPermission',
    method: 'get',
    params: {
      customerId,
    }
  })
}

//获取最新进展列表
export const getNewProgress = (customerId,page,startDate,endDate) => {
  return request({
    url: '/api/beetles-business/customer/get_new_progress',
    method: 'get',
    params: {
      customerId,
      ...page,
      startDate,
      endDate
    }
  })
}
export const getStatusRecord = (customerId) => {
  return request({
    url: '/api/beetles-business/customer/getCustomerStatusList',
    method: 'get',
    params: {
      customerId,
    }
  })
}


